home *** CD-ROM | disk | FTP | other *** search
/ 130 MIDI Tool Box / 130 MIDI Tool Box.iso / midimod1 / mod-form.txt < prev    next >
Text File  |  1993-04-10  |  15KB  |  304 lines

  1. Noisetracker/Soundtracker/Protracker Module Format
  2. --------------------------------------------------
  3. Credits: Norman Lin, Mark Cox, Lars Hamre, Peter Hanning
  4. (All numbers below are given in decimal)
  5.  
  6. Module Format:
  7. # Bytes      Description
  8. -------      -----------
  9. 20           The module's title, padded with null (\0) bytes.
  10.  
  11. (Data repeated for each sample 1-15 or 1-31:)
  12. 22           Sample's name, padded with null bytes.
  13. 2            Sample length in words (ie. multiply by 2 for length in bytes).
  14. 1            Lowest four bits represent a signed nibble (-8..7) which is
  15.              the finetune value for the sample. It is mostly ignored, but I
  16.              think each note is supposed to be 16 "finetunes" from the next.
  17. 1            Volume of sample. Legal values are 0..64.
  18. 2            Start of sample repeat offset in words.
  19. 2            Length of sample repeat in words ( >1 if looping is used)
  20. (End of this sample's data.. each sample uses the same format and they are
  21.  stored sequentially)
  22. NB. All 2 byte lengths are stored with the Hi-byte first, as is usual on
  23.     the Amiga.
  24.  
  25. 1            Number of song positions (ie. number of patterns played
  26.              throughout the song). Legal values are 1..128.
  27. 1            Historically set to 127, but can be safely ignored. Noisetracker
  28.              uses this byte to indicate restart position - this has been
  29.              made redundant by the 'Position Jump' effect.
  30. 128          Pattern table: patterns to play in each song position (0..127).
  31.              Each byte has a legal value of 0..63. The highest value in this
  32.              table is the highest pattern stored, no patterns above this
  33.              value are stored.
  34. (4)          The four letters "M.K." These are the initials of Mahoney &
  35.              Kaktus and were introduced along with the increase to 31
  36.              samples. Startrekker puts "FLT4" or "FLT8" here to indicate
  37.              the # of channels. If no letters are here, then this is the
  38.              start of the pattern data, and only 15 samples are present.
  39.  
  40. (Data repeated for each pattern:)
  41. 1024         Pattern data for each pattern (starting at 0).
  42. (Each pattern has same format and is stored in numerical order.
  43.  See below for pattern format)
  44.  
  45. (Data repeated for each sample:)
  46. xxxxxx       Each sample is stored as a collection of bytes (length of
  47.              a sample was given previously in the module). Each byte is
  48.              a signed value (-128..127) which is the channel data. When
  49.              a sample is played at a pitch of C2, 8000 bytes of channel
  50.              data are sent to the channel per second. Multiply the rate
  51.              by the twelfth root of 2 for each semitone increase in pitch
  52.              eg. moving the pitch up 1 octave doubles the rate. The data
  53.              is stored in the order it is played (eg. first byte is first
  54.              byte played), but if the 'invert loop' effect is used then
  55.              it order is reversed.
  56. (Each sample is stored sequentially)
  57.  
  58. Pattern Format:
  59. Each pattern is divided into 64 divisions. By allocating different tempos
  60. for each pattern and spacing the notes across different amounts of divisions,
  61. different bar sizes can be accomodated.
  62.  
  63. Each division contains the data for each channel (1..4) stored after each
  64. other. Each channel's data in the division has an identical format which
  65. consists of 2 words (4 bytes). Divisions are numbered 0..63. Each division
  66. may be divided into a number of ticks (see 'set speed' effect below).
  67.  
  68. Channel Data:
  69.                    (the four bytes of channel data in a pattern divison)
  70. 7654-3210 7654-3210 7654-3210 7654-3210
  71. wwww xxxxxxxxxxxxxx yyyy zzzzzzzzzzzzzz
  72.  
  73.     wwwwyyyy (8 bits) is the sample for this channel/division (0 = no sample)
  74. xxxxxxxxxxxx (12 bits) is the sample's period (or effect parameter)
  75. zzzzzzzzzzzz (12 bits) is the effect for this channel/division
  76.  
  77. If there is to be no new sample to be played at this division on this
  78. channel, then the old sample on this channel will continue, or at least be
  79. "remembered" for any effects. Only one sample may play on a channel at a
  80. time, so playing a new sample will cancel an old one - even if there has
  81. been no data supplied for the new sample. Though, if you are using a
  82. "silence" sample (ie. no data, only used to turn off other samples) it is
  83. polite to set its default volume to 0.
  84.  
  85. To determine what pitch the sample is to be played on, look up the period
  86. in a table, such as the one below. It is best to do a binary-search,
  87. especially if you plan to use periods outside the "standard" range. Periods
  88. are the internal representation of the pitch, so effects that alter pitch
  89. (eg. sliding) alter the period value (see "effects" below).
  90.  
  91.           C    C#   D    D#   E    F    F#   G    G#   A    A#   B
  92. Octave 1: 856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453
  93. Octave 2: 428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226
  94. Octave 3: 214, 202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113
  95.  
  96. Octave 0:1712,1616,1525,1440,1357,1281,1209,1141,1077,1017, 961, 907,
  97. Octave 4: 107, 101,  95,  90,  85,  80,  76,  71,  67,  64,  60,  57
  98.  
  99. (Octaves 0 and 4 are NOT standard, so don't rely on every tracker being
  100.  able to play them, or even not crashing if being given them - it's just
  101.  nice that if you can code it, to allow them to be read.)
  102.  
  103. Effects:
  104. Effects are written as groups of 4 bits, eg. 1871 = 7 * 256 + 4 * 16 + 15
  105. = [7][4][15]. The high nibble (4 bits) usually determines the
  106. effect, but if it is [14], then the second nibble is used as well.
  107.  
  108. [0]: Arpeggio
  109.   Where [0][x][y] means "play note, note+x semitones, note+y semitones, then
  110.   return to original note". The fluctuations are carried out evenly spaced
  111.   in one pattern division. They are usually used to simulate chords, but
  112.   this doesn't work too well. They are also used to produce heavy vibrato.
  113.   A major chord is when x=4, y=7. A minor chord is when x=3, y=7.
  114.  
  115. [1]: Slide up
  116.   Where [1][x][y] means "smoothly decrease the period of current sample
  117.   by x*16+y after each tick in the division". The ticks/division are set
  118.   with the 'set speed' effect (see below). If the period of the note being
  119.   played is z, then the final period will be z - (x*16 + y)*(ticks - 1).
  120.   As the slide rate depends on the speed, changing the speed will change
  121.   the slide. You cannot slide beyond the note B3 (period 113).
  122.  
  123. [2]: Slide down
  124.   Where [2][x][y] means "smoothly increase the period of current sample
  125.   by x*16+y after each tick in the division". Similar to [1], but lowers
  126.   the pitch. You cannot slide beyond the note C1 (period 856).
  127.  
  128. [3]: Slide to note
  129.   Where [3][x][y] means "smoothly change the period of current sample by
  130.   x*16+y after each tick in the division, never sliding beyond current
  131.   period". The period-length in this channel's division is a parameter to
  132.   this effect, and hence is not played. Sliding to a note is similar to
  133.   effects [1] and [2], but the slide will not go beyond the given period,
  134.   and the direction is implied by that period. If [x] and [y] are both 0,
  135.   then the old slide will continue.
  136.  
  137. [4]: Vibrato
  138.   Where [4][x][y] means "oscillate the sample pitch using a particular
  139.   waveform with amplitude y/16 semitones, such that (x * ticks)/64 cycles
  140.   occur in the division". The waveform is set using effect [14][4]. By
  141.   placing vibrato effects on consecutive divisions, the vibrato effect
  142.   can be maintained. If either [x] or [y] are 0, then the old vibrato
  143.   values will be used.
  144.  
  145. [5]: Continue 'Slide to note', but also do Volume slide
  146.   Where [5][x][y] means "either slide the volume up x*5 or slide the volume
  147.   down y*5, at the same time as continuing the last 'Slide to note'". It is
  148.   illegal for both x and y to be non-zero. You cannot slide outside the
  149.   volume range 0..64. The period-length in this channel's division is a
  150.   parameter to this effect, and hence is not played.
  151.  
  152. [6]: Continue 'Vibrato', but also do Volume slide
  153.   Where [6][x][y] means "either slide the volume up x*5 or slide the volume
  154.   down y*5, at the same time as continuing the last 'Vibrato'". It is
  155.   illegal for both x and y to be non-zero. You cannot slide outside the
  156.   volume range 0..64.
  157.  
  158. [7]: Tremolo
  159.   Where [7][x][y] means "oscillate the sample volume using a particular
  160.   waveform with amplitude y*5, such that (x * ticks)/64 cycles occur in the
  161.   division". The waveform is set using effect [14][7]. Similar to [4].
  162.  
  163. [8]: -- Unused --
  164.  
  165. [9]: Set sample offset
  166.   Where [9][x][y] means "play the sample from offset x*4096 + y*256".
  167.   The offset is measured in words. If no sample is given, yet one is still
  168.   playing on this channel, it should be retriggered to the new offset using
  169.   the current volume.
  170.  
  171. [10]: Volume slide
  172.   Where [10][x][y] means "either slide the volume up x*5 or slide the
  173.   volume down y*5". It is illegal for both x and y to be non-zero. You
  174.   cannot slide outside the volume range 0..64.
  175.  
  176. [11]: Position Jump
  177.   Where [11][x][y] means "stop the pattern after this division, and
  178.   continue the song at song-position x*16+y". This shifts the 'pattern-
  179.   cursor' in the pattern table (see above). Legal values for x*16+y are
  180.   from 0 to 127.
  181.  
  182. [12]: Set volume
  183.   Where [12][x][y] means "set current sample's volume to x*16+y". Legal
  184.   volumes are 0..64.
  185.  
  186. [13]: Pattern Break
  187.   Where [13][x][y] means "stop the pattern after this division, and continue
  188.   the song at the next pattern at division x*16+y". Legal divisions are
  189.   from 0 to 63.
  190.  
  191. [14][0]: Set filter on/off
  192.   Where [14][0][x] means "set sound filter ON if x is 1, and OFF is x is 0".
  193.   This is a hardware command for some Amigas, so if you don't understand
  194.   it, it is better not to use it.
  195.  
  196. [14][1]: Fineslide up
  197.   Where [14][1][x] means "decrement the period of the current sample by x".
  198.   The incrementing takes place at the beginning of the division, and hence
  199.   there is no sliding. You cannot slide beyond the note B3 (period 113).
  200.  
  201. [14][2]: Fineslide down
  202.   Where [14][2][x] means "increment the period of the current sample by x".
  203.   Similar to [14][1] but shifts the pitch down. You cannot slide beyond the
  204.   note C1 (period 856).
  205.  
  206. [14][3]: Set glissando on/off
  207.   Where [14][3][x] means "set glissando ON if x is 1, OFF is x is 0". Used
  208.   in conjunction with [3] ('Slide to note'). If glissando is on, then
  209.   'Slide to note' will slide in semitones, otherwise will perform the
  210.   default smooth slide.
  211.  
  212. [14][4]: Set vibrato waveform
  213.   Where [14][4][x] means "set the waveform of succeeding 'vibrato' effects
  214.   to wave #x". [4] is the 'vibrato' effect.  Possible values for x are:
  215.     0 - sine (default)      /\    /\     (2 cycles)
  216.     4  (without retrigger)     \/    \/
  217.  
  218.     1 - ramp down          | \   | \
  219.     5  (without retrigger)     \ |   \ |
  220.  
  221.     2 - square             ,--,  ,--,
  222.     6  (without retrigger)    '--'  '--'
  223.  
  224.     3 - random
  225.     7  (without retrigger)
  226.   Sorry, don't ask me what the "without retrigger" means.
  227.  
  228. [14][5]: Set finetune value
  229.   Where [14][5][x] means "sets the finetune value of the current sample
  230.   to the signed nibble x". x has legal values of 0..15, corresponding to
  231.   signed nibbles 0..-1.
  232.  
  233. [14][6]: Loop pattern
  234.   Where [14][6][x] means "set the start of a loop to this division if x
  235.   is 0, otherwise after this division, jump back to the start of a loop
  236.   and play it another x times before continuing". If the start of the loop
  237.   was not set, it will default to the start of the current pattern. Hence
  238.   'loop pattern' cannot be performed across multiple patterns. Note that
  239.   loops do not support nesting, and you may generate an infinite loop
  240.   if you try to nest 'loop pattern's.
  241.  
  242. [14][7]: Set tremolo waveform
  243.   Where [14][7][x] means "set the waveform of succeeding 'tremolo' effects
  244.   to wave #x". Similar to [14][4], but alters effect [7] - the 'tremolo'
  245.   effect.
  246.  
  247. [14][8]: -- Unused --
  248.  
  249. [14][9]: Retrigger sample
  250.   Where [14][9][x] means "trigger current sample every x ticks in this
  251.   division". If x is 0, then no retriggering is done (acts as if no
  252.   effect was chosen), otherwise the retriggering begins on the first tick
  253.   and then x ticks after that, etc.
  254.  
  255. [14][10]: Fine volume slide up
  256.   Where [14][10][x] means "increment the volume of the current sample by x".
  257.   The incrementing takes place at the beginning of the division, and hence
  258.   there is no sliding. You cannot slide beyond volume 64.
  259.  
  260. [14][11]: Fine volume slide down
  261.   Where [14][11][x] means "decrement the volume of the current sample by x".
  262.   Similar to [14][10] but lowers volume. You cannot slide beyond volume 0.
  263.  
  264. [14][12]: Cut sample
  265.   Where [14][12][x] means "after the current sample has been played for
  266.   x ticks in this division, its volume will be set to 0". This implies
  267.   that if x is 0, then you will not hear any of the sample. If you wish
  268.   to insert "silence" in a pattern, it is better to use a "silence"-sample
  269.   (see above) due to the lack of proper support for this effect.
  270.  
  271. [14][13]: Delay sample
  272.   Where [14][13][x] means "do not start this division's sample for the
  273.   first x ticks in this division, play the sample after this". This
  274.   implies that if x is 0, then you will hear no delay. Note that this
  275.   effect only influences a sample if it was started in this division.
  276.  
  277. [14][14]: Delay pattern
  278.   Where [14][14][x] means "after this division, the pattern will not be
  279.   played for the length of x notes, resume the pattern after this".
  280.  
  281. [14][15]: Invert loop
  282.   Where [14][15][x] means "if x is greater than 0, then play the current
  283.   sample's loop backwards at speed x, otherwise play the sample forward".
  284.   It will only work if the sample's loop (defined previously) is not too
  285.   big.
  286.  
  287. [15]: Set speed
  288.   Where [15][x][y] means "set speed to x*16+y". Though it is not that
  289.   simple. Let z = x*16+y. z=0 is the same as z=1. If z<32 then it means
  290.   "set ticks/division to z and beats/min to 768/z" otherwise it means "set
  291.   beats/min to z". Default values are 6 ticks/division, and 128 beats/min
  292.   (4 divisions = 1 beat). It is best to not mix the different types of
  293.   "set speed" as I have seen 4 different trackers act 4 different ways
  294.   when mixing them.
  295.  
  296. NB. I have tested most of the effects, but some were a bit hard to test
  297. (such as filter, etc.) It is probably better to use this document as a
  298. guide rather than as a hard-and-fast definition of the module format.
  299. Oh.. and yes, I would normally give bytes as hex values, but it is easier
  300. to understand a consistant notation.
  301.  
  302. Andrew Scott (Adrenalin Software), INTERNET:ascott@tartarus.uwa.edu.au
  303. Author of MIDIMOD.
  304.